<?php

class Logger{
	
	public static $nl = "\r\n";
	public static $hr = "----------";
	
	private static function _getFilename(){
		return DIR_ROOT . "/../log/log." . date("Y-m-d") . ".txt";
	}
	
	public static function clear(){
		file_put_contents(self::_getFilename(), "");
	}
	
	public static function add($message, $type="ERROR"){
		$line = self::$nl . self::$nl . self::$hr . self::$nl . 
				date("Y-m-d H:i:s") . self::$nl . 
				$type . self::$nl .
				$message;
		file_put_contents(self::_getFilename(), $line, FILE_APPEND);
	}
}